﻿#pragma once

#include "MaterialGraph/Node/MaterialGraphNodeViewModel.h"
#include "MaterialVectorOperationNodeModel.h"
#include "MaterialVectorOperationNodeViewModel.m.h"

RCLASS()
class RMaterialVectorOperationNodeViewModel : public RMaterialGraphNodeViewModel
{
    ROBJECT

public:
    virtual void BindModel(
        TSharedObjectPtr<RMaterialGraphNodeModel> InModel
        , TSharedObjectPtr<RMaterialGraphViewModel> InGraph
    );

    virtual float GetNodeWidth() const  override{ return 200.0f; }
    virtual int64_t GetLineNum() const override;
    virtual CString GetName() const override { return GetOperationName(); };

    virtual CString GetInputPinName(int64_t Index) const override;
    virtual CString GetOutputPinName(int64_t Index) const override{ return U"结果"; }

    CString GetOperationName() const;

    EMaterialVectorOperationType GetOperationType() const;
    void SetOperationType(EMaterialVectorOperationType InOperationType);

    //唯一的输出引脚是一个向量还是一个浮点数
    //如果是一个浮点数，返回true
    //如果是一个向量，返回false
    bool IsOutputFloat() const;
protected:
    TWeakObjectPtr<RMaterialVectorOperationNodeModel> OperationModel;

    void ReassignLineNumberAndNodeHeight();

    int64_t TotalLineNum = 0;
};